package com.family168.leona.web;

import com.family168.core.hibernate.HibernateEntityDao;
import com.family168.leona.domain.Authtype;
import com.family168.leona.domain.Subject;
import com.family168.leona.manager.SubjectManager;


/**
 * Subject action.
 *
 */
public class SubjectAction extends AbstractGridAction<Subject> {
    /** * serial. */
    static final long serialVersionUID = 0L;

    /** * Subject manager. */
    private transient SubjectManager subjectManager = null;


    //
    public void setSubjectManager(SubjectManager subjectManager) {
        this.subjectManager = subjectManager;
    }

    public HibernateEntityDao<Subject> getManager() {
        return subjectManager;
    }

    private Long authtypeId;


    public void setAuthtypeId(Long authtypeId) {
        this.authtypeId = authtypeId;
    }

    public void beforeSave(Subject model) {
        model.setAuthtype(subjectManager.get(Authtype.class, authtypeId));
    }


    public String[] getExcludes() {
        return new String[] {
            "subjects", "hibernateLazyInitializer", "handler", "job",
            "state", "department", "accepterBumfs", "senderBumfs",
            "accepterMessages", "senderMessages", "signs"
        };
    }
}
